package com.bytecollege.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bytecollege.mapper.FootmarkMapper;
import com.bytecollege.model.Footmark;
import com.bytecollege.service.FootmarkService;
import com.bytecollege.vo.FootMarkVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName: FootmarkServiceImpl
 * @Description:
 * @Author: Sun
 * @Date: 2022/10/18 21:03
 */
@Service
public class FootmarkServiceImpl extends ServiceImpl<FootmarkMapper,Footmark> implements FootmarkService {
    @Autowired
    private FootmarkMapper footmarkMapper;

    /**
     * 添加足迹
     * @param footmark
     * @return
     */
    public int addFootmark(Footmark footmark){
        return footmarkMapper.insert(footmark);
    }

    /**
     * 查询所有足迹
     * @return
     */
    public List<Footmark> getAll(){
        return footmarkMapper.selectList(null);
    }

    /**
     * 更新足迹
     * @param footmark
     * @return
     */
    public int modFootmark(Footmark footmark){
        return footmarkMapper.updateById(footmark);
    }

    /**
     * 我的足迹分页
     * @param page 分页
     * @param userId 用户ID
     * @return
     */
    public List<FootMarkVo> getAllFootMark(Page<FootMarkVo> page, Integer userId){

        return footmarkMapper.getAllFootMark(page,userId);
    }

    /**
     * 删除足迹
     * @param id
     * @return
     */

    public int delFootMark(Integer id){
        return footmarkMapper.deleteById(id);
    }
}